# Contributor: Leo <thinkabit.ukim@gmail.com>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=falkon
pkgver=24.08.2
pkgrel=0
pkgdesc="Cross-platform Qt Web Browser"
url="https://github.com/KDE/falkon"
# armhf, ppc64le, s390x, riscv64 and loongarch64 blocked by qt6-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64 !loongarch64"
license="GPL-3.0-or-later"
depends="qt6-qtbase-sqlite"
makedepends="
	extra-cmake-modules
	karchive-dev
	kcoreaddons-dev
	kcrash-dev
	ki18n-dev
	kio-dev
	kwallet-dev
	libxcb-dev
	openssl-dev>3
	purpose-dev
	python3
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qttools-dev
	qt6-qtwebengine-dev
	samurai
	xcb-util-dev
	"
checkdepends="xvfb-run"
subpackages="$pkgname-lang $pkgname-bash-completion:bashcomp:noarch"
_repo_url="https://invent.kde.org/network/falkon.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/falkon-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DBUILD_TESTING=ON
	cmake --build build
}

check() {
	# Requires working OpenGL
	# qmlhistoryapitest, qmlcookiesapitest, qmltabsapitest and qmlwindowsapitest are SIGTRAP'ing
	xvfb-run -a ctest --test-dir build --output-on-failure -E "falkon-(locationbar|webtab|qml-qml(tabsapi|topsitesapi)|sitesettings)test" -j1
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion/completions
}

sha512sums="
6564cb7f091c84728cae315bba08ae654a417fd197188bb43c6a78cd9d5ecb9e3c0761e937fe527eb7350e19aa52c5169b3606c7dd01dba08eb8aac502aa71dc  falkon-24.08.2.tar.xz
"
